#include "ShaderMaterial.h"
POCELAIN_NAMESPACE_BEGIN
RawShaderMaterial::RawShaderMaterial()
{
}
RawShaderMaterial::~RawShaderMaterial()
{
    for(auto &it : mMapNameUniform)
    {
        it.second->release();
    }
}
void RawShaderMaterial::shaderSource(EShaderType shaderType,std::string source)
{
    switch(shaderType)
    {
    case EShaderType::E_VERTEX:
        {
            // if(nullptr==mVertShader)
            // {
            //     mVertShader = new OpenGLShader(EShaderType::E_VERTEX);
            // }
            // mVertShader->resetByString(source);
            mVertShader = source;
            break;
        }
    case EShaderType::E_TESSELATION:
        {
            // if(nullptr==mTessShader)
            // {
            //     mTessShader = new OpenGLShader(EShaderType::E_TESSELATION);
            // }
            // mTessShader->resetByString(source);
            mTessShader = source;
            break;
        }
    case EShaderType::E_GEOMETRY:
        {
            // if(nullptr==mGeomShader)
            // {
            //     mGeomShader = new OpenGLShader(EShaderType::E_GEOMETRY);
            // }
            // mGeomShader->resetByString(source);
            mGeomShader = source;
            break;
        }
    case EShaderType::E_FRAGMENT:
        {
            // if(nullptr==mFragShader)
            // {
            //     mFragShader = new OpenGLShader(EShaderType::E_FRAGMENT);
            // }
            // mFragShader->resetByString(source);
            mFragShader = source;
            break;
        }
    default:
        POCELAIN_LOG_ERROR("Error shader type");
        break;
    }
}
std::string RawShaderMaterial::getShaderSource(EShaderType shaderType) const
{
    switch(shaderType)
    {
    case EShaderType::E_VERTEX:
        {
            return mVertShader;
            break;
        }
    case EShaderType::E_TESSELATION:
        {
            return mTessShader;
            break;
        }
    case EShaderType::E_GEOMETRY:
        {
            return mGeomShader;
            break;
        }
    case EShaderType::E_FRAGMENT:
        {
            return mFragShader;
            break;
        }
    default:
        POCELAIN_LOG_ERROR("Error shader type");
        break;
    }
    return "";
}

ShaderMaterial::ShaderMaterial()
{
}
ShaderMaterial::~ShaderMaterial()
{
}
POCELAIN_NAMESPACE_END
